<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .test {
            width: 200px;
            height: 100px;
            background-color: green;
            transition: all 0.3s;
        }

        .active {
            background-color: blue;
            width: 800px;
            height: 50px;
            border-radius: 25px;
            box-shadow: 0 0 10px #000;
        }
    </style>
</head>

<body>
    <div class="test"></div>
    <button class="add">添加</button>
    <button class="remove">删除</button>
    <button class="toggle">切换</button>
    <button class="has">检测</button>
    <script src="./jquery-3.6.0.js"></script>
    <script>
        $('.add').on('click', function () {
            $('div').addClass('active aa bb cc')
        })
        $('.remove').on('click', function () {
            $('div').removeClass('aa cc')
        })
        $('.toggle').on('click', function () {
            $('div').toggleClass('active')
        })
        $('.has').on('click', function () {
            let a = $('div').hasClass('active')
            console.log(a);
        })
    </script>
</body>

</html>